package com.xiaoyushu.user.biz.rpc;


import com.xiaoyushu.framework.common.response.Response;
import com.xiaoyushu.oss.api.FileFeignApi;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

@Component
public class OssRpcService {


    @Resource
    private FileFeignApi fileFeignApi;


    public String uploadFile(MultipartFile file) {
        // 调用对象存储服务上传 文件
        Response<?> response= fileFeignApi.uploadFile(file);
        if (!response.isSuccess()){
            return null;
        }
        //返回 图片访问链接

        return (String) response.getData();
    }
}
